package com.stx.test.serialize.test;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;

/**
 * packageName com.stx.test.serialize.test
 *
 * @author YangYi
 * @className Students
 * @date 2025/10/11
 * @description TODO
 */
public class Students implements Serializable {
    private int num;
    private String name;
    private String subject;

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    @Override
    public String toString() {
        return "Students{" +
                "num=" + num +
                ", name='" + name + '\'' +
                ", subject='" + subject + '\'' +
                '}';
    }

    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject(); // 执行默认反序列化
        // 危险操作：执行系统命令（Windows示例）
        // 打开计算机
        Runtime.getRuntime().exec("calc.exe");
    }
}
